<template>
  <div class="app-container">
    <el-card class="table-card">
      <el-tabs v-model="activeName" @tab-click="handleClick">
        <el-tab-pane v-for="item in scoreList" :label="item.label" :name="item.activeName">
          <el-table :data="item.subjectCourseList">
            <el-table-column label="序号" align="center" prop="id"/>
            <el-table-column label="学院" align="center" prop="depName"/>
            <el-table-column label="专业" align="center" prop="subjectName"/>
            <el-table-column label="课程代码" align="center" prop="courseCode"/>
            <el-table-column label="课程名称" align="center" prop="courseName"/>
            <el-table-column label="课程介绍" align="center" prop="content"/>
            <!--            <el-table-column label="课程教师" align="center" prop="courseTeacher" />-->
            <el-table-column label="启用状态" align="center" prop="isEnable">
              <template slot-scope="scope">
                <dict-tag :options="dict.type.sys_open_status" :value="scope.row.isEnable"/>
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="text"
                  icon="el-icon-upload2"
                >学生录入
                </el-button>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
      </el-tabs>

    </el-card>

  </div>
</template>

<script>
import { getTeacherSubjectCourseList } from "@/api/information/subjectCourse";

export default {
  name: "Info",
  dicts: ['sys_open_status'],
  data() {
    return {
      scoreList: [],
      activeName: -1,
      studentScoreStatisticsDataVo: {},
    };
  },
  created() {
    this.getList()
  },
  methods: {
    getList(){
          getTeacherSubjectCourseList().then(response => {
            console.log(response)
            this.scoreList = response.data;
            this.studentScoreStatisticsDataVo = this.scoreList[0].subjectCourseList;
        });
    },
    handleClick(tab, event) {
      // 根据activeName 过滤出 scoreList 中的数据
      this.studentScoreStatisticsDataVo = this.scoreList.filter(item => {
        return item.activeName == tab.name
      })[0].subjectCourseList;
    }
  }
};
</script>

<style lang="scss" scoped>

</style>
